<template>
     <view>
         <view class="text-cut">
             {{timeArray.time | formatDate}}
         </view>
     </view>
 </template>
 <script>
     export default {
         data() {
             return {
                 timeArray: [],
             };
         },
         onLoad() {
             this.getList();
         },
         methods: {
             getList() {
                 uni.request({
                     url: "../../static/test.json",
                     method: 'get',
                     dataType: 'json',
                     success: (res) => {
                         this.timeArray = res.data;
                     },
                     // fail: function (err) {
                     //        console.log("服务器繁忙")
                     // }                
                 });
             },
     
         },
         //时间戳的处理    
         filters: {
             formatDate: function(value) {
                 var date = new Date();
                 //date.setTime(value);
                 var month = date.getMonth() + 1;
                 var hours = date.getHours();
                 if (hours < 10)
                     hours = "0" + hours;
                 var minutes = date.getMinutes();
                 if (minutes < 10)
                     minutes = "0" + minutes;
                 var time = date.getFullYear() + "-" + month + "-" + date.getDate() +
                     " " + hours + ":" + minutes;
                 return time;
             }
  
         },
     }
 </script>
 <style>
 </style>
 